#ifndef TABVIEW_H
#define TABVIEW_H

#include <string>
#include <map>
#include "view.h"
class Font;

class TabView : public View {
public:
     TabView(Rect rect, Font *pFont);
     void createTab(const std::string &name, View *pView);
     void setActiveTab(const std::string &name);
     void setRect(Rect r);
     void paint(bool all=false);
     void keyDown(int keycode, int modifiers, int unichar);
     void mouseDown(Point p, int button);
     void mouseUp(Point p, int button);
     void mouseMove(Point p, Point dp);
     void mouseEnter(Point p);
     void mouseExit(Point p);
     bool grabMouse();
     bool needPaint();
     void update();
     bool grabKeys();
     bool hasFocus();
     void focus();
     void blur();

private:
     static const int Padding = 2;
     static const int Radius = 3;
     static const int LineThickness = 1;
     Rect m_viewRect;
     std::string m_activeTab;
     std::map<std::string,View*> m_tabs;
     std::vector<std::string> m_tabOrder;
     bool m_paintTabs;

     void paintTabs();
     Rect tabRect();
     Rect tabRect(const std::string &name);
};

#endif
